<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hammerspoon docs: TurboBoost</title>
    <style type="text/css">
      a { text-decoration: none; }
      a:hover { text-decoration: underline; }
      th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
      td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
      table { width: 100% ; border: 1px solid #0; text-align: left; }
      section > table table td { width: 0; }
    </style>
    <link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
  </head>
  <body>
    <header>
      <h1><a href="./index.html">docs</a> &raquo; TurboBoost</h1>
      <p>A spoon to load/unload the Turbo Boost Disable kernel extension
from https://github.com/rugarciap/Turbo-Boost-Switcher.</p>
<p>Note: this spoon by default uses sudo to load/unload the kernel
extension, so for it to work from Hammerspoon, you need to
configure sudo to be able to load/unload the extension without a
password, or configure the load_kext_cmd and unload_kext_cmd
variables to use some other mechanism that prompts you for the
credentials.</p>
<p>For example, the following configuration (stored in
/etc/sudoers.d/turboboost) can be used to allow loading and
unloading the module without a password:</p>

<pre><code>Cmnd_Alias    TURBO_OPS = /sbin/kextunload /Applications/Turbo Boost Switcher.app/Contents/Resources/DisableTurboBoost.64bits.kext, /usr/bin/kextutil /Applications/Turbo Boost Switcher.app/Contents/Resources/DisableTurboBoost.64bits.kext

%admin ALL=(ALL) NOPASSWD: TURBO_OPS
</code></pre>
<p>If you use this, please support the author of Turbo Boost Disabler
by purchasing the Pro version of the app!</p>
<p>Download: <a href="https://github.com/Hammerspoon/Spoons/raw/master/Spoons/TurboBoost.spoon.zip">https://github.com/Hammerspoon/Spoons/raw/master/Spoons/TurboBoost.spoon.zip</a></p>

      </header>
      <h3>API Overview</h3>
      <ul>
        <li>Variables - Configurable values</li>
          <ul>
            <li><a href="#check_kext_cmd">check_kext_cmd</a></li>
            <li><a href="#disable_on_start">disable_on_start</a></li>
            <li><a href="#disabled_icon_path">disabled_icon_path</a></li>
            <li><a href="#enabled_icon_path">enabled_icon_path</a></li>
            <li><a href="#kext_path">kext_path</a></li>
            <li><a href="#kext_paths">kext_paths</a></li>
            <li><a href="#load_kext_cmd">load_kext_cmd</a></li>
            <li><a href="#logger">logger</a></li>
            <li><a href="#notify">notify</a></li>
            <li><a href="#reenable_on_stop">reenable_on_stop</a></li>
            <li><a href="#unload_kext_cmd">unload_kext_cmd</a></li>
          </ul>
        <li>Methods - API calls which can only be made on an object returned by a constructor</li>
          <ul>
            <li><a href="#bindHotkeys">bindHotkeys</a></li>
            <li><a href="#setState">setState</a></li>
            <li><a href="#start">start</a></li>
            <li><a href="#status">status</a></li>
            <li><a href="#stop">stop</a></li>
            <li><a href="#toggle">toggle</a></li>
          </ul>
      </ul>
      <h3>API Documentation</h3>
        <h4 class="documentation-section">Variables</h4>
          <section id="check_kext_cmd">
            <a name="//apple_ref/cpp/Variable/check_kext_cmd" class="dashAnchor"></a>
            <h5><a href="#check_kext_cmd">check_kext_cmd</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.check_kext_cmd</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Command to execute to check whether the DisableTurboBoost kernel extension is loaded.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>Default value: <code>&quot;/usr/sbin/kextstat | grep com.rugarciap.DisableTurboBoost&quot;</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L100">Source/TurboBoost.spoon/init.lua line 100</a></td>
              </tr>
            </table>
          </section>
          <section id="disable_on_start">
            <a name="//apple_ref/cpp/Variable/disable_on_start" class="dashAnchor"></a>
            <h5><a href="#disable_on_start">disable_on_start</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.disable_on_start</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean to indicate whether Turbo Boost should be disabled when</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L45">Source/TurboBoost.spoon/init.lua line 45</a></td>
              </tr>
            </table>
          </section>
          <section id="disabled_icon_path">
            <a name="//apple_ref/cpp/Variable/disabled_icon_path" class="dashAnchor"></a>
            <h5><a href="#disabled_icon_path">disabled_icon_path</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.disabled_icon_path</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Where to find the icon to use for the &quot;Disabled&quot; icon.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>Default value uses the icon from the Turbo Boost application: <code>&quot;/Applications/Turbo Boost Switcher.app/Contents/Resources/icon_off.tiff&quot;</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L121">Source/TurboBoost.spoon/init.lua line 121</a></td>
              </tr>
            </table>
          </section>
          <section id="enabled_icon_path">
            <a name="//apple_ref/cpp/Variable/enabled_icon_path" class="dashAnchor"></a>
            <h5><a href="#enabled_icon_path">enabled_icon_path</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.enabled_icon_path</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Where to find the icon to use for the &quot;Enabled&quot; icon.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>Default value uses the icon from the Turbo Boost application: <code>&quot;/Applications/Turbo Boost Switcher.app/Contents/Resources/icon.tiff&quot;</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L113">Source/TurboBoost.spoon/init.lua line 113</a></td>
              </tr>
            </table>
          </section>
          <section id="kext_path">
            <a name="//apple_ref/cpp/Variable/kext_path" class="dashAnchor"></a>
            <h5><a href="#kext_path">kext_path</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.kext_path</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Where the DisableTurboBoost.kext file is located.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L67">Source/TurboBoost.spoon/init.lua line 67</a></td>
              </tr>
            </table>
          </section>
          <section id="kext_paths">
            <a name="//apple_ref/cpp/Variable/kext_paths" class="dashAnchor"></a>
            <h5><a href="#kext_paths">kext_paths</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.kext_paths</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>List with paths to check for the DisableTurboBoost.kext file. The first one</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L57">Source/TurboBoost.spoon/init.lua line 57</a></td>
              </tr>
            </table>
          </section>
          <section id="load_kext_cmd">
            <a name="//apple_ref/cpp/Variable/load_kext_cmd" class="dashAnchor"></a>
            <h5><a href="#load_kext_cmd">load_kext_cmd</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.load_kext_cmd</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Command to execute to load the DisableTurboBoost kernel extension.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>This command must execute with root privileges and either query the user for the credentials, or be configured (e.g. with sudo) to run without prompting.</li>
<li>The string &quot;%s&quot; in this variable gets replaced with the value of TurboBoost.kext_path. Default value: <code>&quot;/usr/bin/sudo /usr/bin/kextutil '%s'&quot;</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L82">Source/TurboBoost.spoon/init.lua line 82</a></td>
              </tr>
            </table>
          </section>
          <section id="logger">
            <a name="//apple_ref/cpp/Variable/logger" class="dashAnchor"></a>
            <h5><a href="#logger">logger</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.logger</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L37">Source/TurboBoost.spoon/init.lua line 37</a></td>
              </tr>
            </table>
          </section>
          <section id="notify">
            <a name="//apple_ref/cpp/Variable/notify" class="dashAnchor"></a>
            <h5><a href="#notify">notify</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.notify</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean indicating whether notifications should be generated when Turbo Boost is enabled/disabled. Default value: <code>true</code></p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L108">Source/TurboBoost.spoon/init.lua line 108</a></td>
              </tr>
            </table>
          </section>
          <section id="reenable_on_stop">
            <a name="//apple_ref/cpp/Variable/reenable_on_stop" class="dashAnchor"></a>
            <h5><a href="#reenable_on_stop">reenable_on_stop</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.reenable_on_stop</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean to indicate whether Turbo Boost should be reenabled when</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L51">Source/TurboBoost.spoon/init.lua line 51</a></td>
              </tr>
            </table>
          </section>
          <section id="unload_kext_cmd">
            <a name="//apple_ref/cpp/Variable/unload_kext_cmd" class="dashAnchor"></a>
            <h5><a href="#unload_kext_cmd">unload_kext_cmd</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost.unload_kext_cmd</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Command to execute to unload the DisableTurboBoost kernel extension.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>This command must execute with root privileges and either query the user for the credentials, or be configured (e.g. with sudo) to run without prompting.</li>
<li>The string &quot;%s&quot; in this variable gets replaced with the value of TurboBoost.kext_path. Default value: <code>&quot;/usr/bin/sudo /sbin/kextunload '%s'&quot;</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L91">Source/TurboBoost.spoon/init.lua line 91</a></td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Methods</h4>
          <section id="bindHotkeys">
            <a name="//apple_ref/cpp/Method/bindHotkeys" class="dashAnchor"></a>
            <h5><a href="#bindHotkeys">bindHotkeys</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:bindHotkeys(mapping)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Binds hotkeys for TurboBoost</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>mapping - A table containing hotkey objifier/key details for the following items:<ul>
<li>hello - Say Hello</li>
</ul>
</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L197">Source/TurboBoost.spoon/init.lua line 197</a></td>
              </tr>
            </table>
          </section>
          <section id="setState">
            <a name="//apple_ref/cpp/Method/setState" class="dashAnchor"></a>
            <h5><a href="#setState">setState</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:setState(state, notify)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Sets whether Turbo Boost should be disabled (kernel extension loaded) or enabled (normal state, kernel extension not loaded).</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>state - A boolean, false if Turbo Boost should be disabled (load kernel extension), true if it should be enabled (unload kernel extension if loaded).</li>
<li>notify - Optional boolean indicating whether a notification should be produced. If not given, the value of TurboBoost.notify is used.</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>Boolean indicating new state</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L129">Source/TurboBoost.spoon/init.lua line 129</a></td>
              </tr>
            </table>
          </section>
          <section id="start">
            <a name="//apple_ref/cpp/Method/start" class="dashAnchor"></a>
            <h5><a href="#start">start</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:start()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Starts TurboBoost</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>The TurboBoost object</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L209">Source/TurboBoost.spoon/init.lua line 209</a></td>
              </tr>
            </table>
          </section>
          <section id="status">
            <a name="//apple_ref/cpp/Method/status" class="dashAnchor"></a>
            <h5><a href="#status">status</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:status()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Check whether Turbo Boost is enabled</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>true if TurboBoost is enabled (kernel ext not loaded), false otherwise.</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L168">Source/TurboBoost.spoon/init.lua line 168</a></td>
              </tr>
            </table>
          </section>
          <section id="stop">
            <a name="//apple_ref/cpp/Method/stop" class="dashAnchor"></a>
            <h5><a href="#stop">stop</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:stop()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Stops TurboBoost</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>The TurboBoost object</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L230">Source/TurboBoost.spoon/init.lua line 230</a></td>
              </tr>
            </table>
          </section>
          <section id="toggle">
            <a name="//apple_ref/cpp/Method/toggle" class="dashAnchor"></a>
            <h5><a href="#toggle">toggle</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>TurboBoost:toggle()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Toggle TurboBoost status</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>New TurboBoost status, after the toggle</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/TurboBoost.spoon/init.lua#L183">Source/TurboBoost.spoon/init.lua line 183</a></td>
              </tr>
            </table>
          </section>
  </body>
</html>